Ext.define('appmod.view.knowledge.content.colligation.List', {
    extend: 'Ext.grid.Panel',
    alias: [
		'widget.knowledge.content.colligation.list',
		'widget.knowledge-content-colligation-list'
	],
	requires:[
		'Ext.ux.form.SearchField'
	],	
    initComponent: function() {
		//--- this variable is set for winCat
		var me = this;

        Ext.applyIf(me, {
            columns: [
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'title',
                    header: '主题',
					minWidth:'100'
                },
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'content',
                    header: '内 容',
					flex:1
                },				
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'shared',
                    header: '访问级别',
					minWidth:'100',
					renderer:function(value) {
						if (value == 1) {
							return '用户组访问';
						} else if (value == 2) {
							return '完全访问';
						} else {
							return '私有';
						}
					}
                }				
            ],
            viewConfig: {

            },
 			dockedItems: [
				{
					xtype: 'toolbar',
	        		dock: 'top',
	        		items: [
						{
							text:'查看',
							action:'viewColligation'
						},
						{
							text:'新增知识点',
							action:'addColligation'
						},
						{
							text:'删除知识点',
							action:'deleteColligation'
						},
						'-',
						{
					        width: 200,
					        fieldLabel: '查询',
					        labelWidth: 40,
					        xtype: 'searchfield'
				        }							     		
	        		]
	    		},
                {
                    xtype: 'pagingtoolbar',
                    width: 360,
                    displayInfo: true,
                    dock: 'bottom'
                }
            ]			
        });

        me.callParent(arguments);
    },
	
	bindStore:function(store) {
		var me = this;
		var pagingbar = me.down('pagingtoolbar');
		pagingbar.bindStore(store);
		
		var searchField = me.down('searchfield');
		searchField.bindStore(store);
		me.callParent(arguments);		
	}
		
});